local yijin = fk.CreateSkill{
    name = "ym2__yijin"
}
Fk:loadTranslationTable{
    ["ym2__yijin"] = "饴津",
    [":ym2__yijin"] = "当你对其他角色造成伤害时，你可以弃置目标或摸一张牌；若如此做，造成此伤害后，目标对你造成等量伤害。",
    ["#ym2__yijin-prompt"] = "是否发动 饴津，弃置%dest一张牌或摸一张牌，然后受到其造成的%arg点伤害",
    ["#ym2__yijin-virtual"] = "是否发动 饴津，弃置%dest一张牌或摸一张牌，然后受到其造成的%arg点视为伤害",
    ["#ym2__yijin-discard"] = "饴津：弃置%dest一张牌或摸一张牌",

    ["$ym2__yijin1"] = "既品世间百味，当知何物最怡。",
    ["$ym2__yijin2"] = "青锋寻巢，解蜜为宴，可释诸般苦。",
}
yijin:addEffect(fk.DamageCaused,{
    anim_type = "control",
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(yijin.name) then
            return target == player and data.to and data.to ~= player
        end
    end,
    on_cost = function (self, event, target, player, data)
        local prompt = "#ym2__yijin-prompt::"..data.to.id..":"..data.damage
        if data.isVirtualDMG then
            prompt = "#ym2__yijin-virtual::"..data.to.id..":"..data.damage
        end
        if player.room:askToSkillInvoke(player,{
            skill_name = yijin.name,
            prompt = prompt
        }) then
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        data.extra_data = data.extra_data or {}
        data.extra_data.ym2__yijin = data.damage
        local cards = {}
        if not data.to:isNude() then
            cards = room:askToChooseCards(player, {
                max = 1,
                min = 0,
                target = data.to,
                flag = "he",
                skill_name = yijin.name,
                prompt = "#ym2__yijin-discard::"..data.to.id,
            })
        end
        if #cards > 0 then
            room:throwCard(cards, yijin.name, data.to, player)
        else
            player:drawCards(1, yijin.name)
        end
    end,
})
yijin:addEffect(fk.Damage,{
    can_refresh = function (self, event, target, player, data)
        return target == player and data.extra_data and data.extra_data.ym2__yijin
    end,
    on_refresh = function (self, event, target, player, data)
        player.room:damage{
            from = data.to,
            to = player,
            damage = data.extra_data.ym2__yijin,
            isVirtualDMG = data.isVirtualDMG,
            skillName = yijin.name,
        }
    end,
})
return yijin